package com.chapter05;

import com.bdqn.util.JDBCUtils;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

public class Test02_Statement {
    public static void main(String[] args) throws SQLException, ClassNotFoundException {

        long start = System.currentTimeMillis();

        Connection connection = JDBCUtils.getConnection();
        Statement statement = connection.createStatement();

        for (int i = 0; i < 20000; i++) {
            String sql = "INSERT INTO goods(`name`) VALUES('张三" + i + "');";
            statement.executeUpdate(sql);
        }

        JDBCUtils.closeResource(connection, statement, null);

        long end = System.currentTimeMillis();
        System.out.println(end - start);
        // 51662ms
    }
}
